/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MenuPartida.java
 *
 * Created on 31/05/2009, 12:58:42 PM
 */

package gui;

import Multimedia.MediaSonido;
import javax.swing.JFrame;

/**
 *
 * @author Arquitectura
 */
public class MenuPartida extends javax.swing.JFrame {

    public  MediaSonido sonidoLogin;
    private Home gc;
    public  String Usario = new String();
    private CrearPartida cp;
    private UnirseAPartida up;

    /** Creates new form MenuPartida */
     public MenuPartida(){
         initComponents();
        
        xPnlFondo pnlFondo = new xPnlFondo(12);
        this.add (pnlFondo);
        this.pack();
         this.setSize(800, 635); //El 635 depende (alto) depende del Skin usado.
        this.setLocationRelativeTo(null);
     }


    public MenuPartida(Home gc, String usuarioEntrada,MediaSonido sonidoLoginEntrada) {

        this.gc = gc;
        this.Usario = usuarioEntrada;
        this.sonidoLogin = sonidoLoginEntrada;
        initComponents();
        
         
        //Manejo de Graficos
        xPnlFondo pnlFondo = new xPnlFondo(12);
        this.add (pnlFondo);
        this.pack();
        this.setSize(800, 635); //El 635 depende (alto) depende del Skin usado.
        this.setLocationRelativeTo(null);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BTN_crearPartida = new javax.swing.JButton();
        BTN_unirsePartida = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        BTN_crearPartida.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_crearpartida.png"))); // NOI18N
        BTN_crearPartida.setBorder(null);
        BTN_crearPartida.setBorderPainted(false);
        BTN_crearPartida.setContentAreaFilled(false);
        BTN_crearPartida.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_crearpartida_roll.png"))); // NOI18N
        BTN_crearPartida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BTN_crearPartidaActionPerformed(evt);
            }
        });

        BTN_unirsePartida.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_unirseapartida.png"))); // NOI18N
        BTN_unirsePartida.setBorder(null);
        BTN_unirsePartida.setBorderPainted(false);
        BTN_unirsePartida.setContentAreaFilled(false);
        BTN_unirsePartida.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/BTN_unirseapartida_roll.png"))); // NOI18N
        BTN_unirsePartida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BTN_unirsePartidaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(286, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(BTN_unirsePartida)
                    .addComponent(BTN_crearPartida))
                .addGap(279, 279, 279))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(210, 210, 210)
                .addComponent(BTN_crearPartida)
                .addGap(18, 18, 18)
                .addComponent(BTN_unirsePartida)
                .addContainerGap(240, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-800)/2, (screenSize.height-600)/2, 800, 600);
    }// </editor-fold>//GEN-END:initComponents

    private void BTN_crearPartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BTN_crearPartidaActionPerformed
        // TODO add your handling code here:
        cp = new CrearPartida(this.gc,this, this.Usario, sonidoLogin);
        this.setVisible(false);
        cp.setVisible(true);
    }//GEN-LAST:event_BTN_crearPartidaActionPerformed

    private void BTN_unirsePartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BTN_unirsePartidaActionPerformed
        // TODO add your handling code here:
      try{
          
        this.setVisible(false);
        up = new UnirseAPartida(this.gc, this, this.Usario, sonidoLogin);
        up.setVisible(true);
      }catch(Exception e)
      {
        
      }
    }//GEN-LAST:event_BTN_unirsePartidaActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
       
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MenuPartida().setVisible(true);

            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BTN_crearPartida;
    private javax.swing.JButton BTN_unirsePartida;
    // End of variables declaration//GEN-END:variables

}
